<template>
  <div class="pages">
    <div class="block">
      <div class="block">
        <el-pagination
          background
          @size-change="handleSizeChange"
          @current-change="handleCurrentChange"
          :current-page.sync="listpag.page"
          :page-sizes="[10, 20, 30, 40]"
          :page-size="listpag.limit"
          layout="prev,pager, next,sizes, jumper"
          :total="100"
        >
        </el-pagination>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  data () {
    return { }
  },
  props: {
    listpag: {
      type: Object,
      required: true
    }
  },
  name: 'PageTool',
  methods: {
    handleSizeChange (val) {
      console.log(`每页 ${val} 条`)
      this.$emit('pagenumber', val)
    },
    handleCurrentChange (val) {
      console.log(`当前页: ${val}`)
      this.$emit('page', val)
    }
  }

}
</script>

<style lang="scss" scoped>
::v-deep .el-pagination {
  float: right;
}
</style>
